<?php

declare(strict_types=1);

namespace app\model;

use think\Model;
use think\facade\Db;

/**
 * @mixin \think\Model
 */
class GoodsSpec extends Model
{
    //获取商品规格
    public static function list($id)
    {
        $list = Db::name('goods_spec')->where('good_id', $id)->select();
        return $list;
    }

    //删除商品规格
    public static function del($id)
    {
        $res = Db::name('goods_spec')->where('good_id', $id)->delete();
        return true;
    }
    //更改商品规格
    public static function edit($id, $data)
    {
        $del = Db::name('goods_spec')->where('good_id', $id)->delete();
        $res = Db::name('goods_spec')->insertAll($data);
        return $res;
    }
}
